package com.duan.laugh.common.core.exception;

import lombok.NoArgsConstructor;

/**
 * checked异常
 *
 * @author duanjw
 */
@NoArgsConstructor
public class CheckedException extends BaseRuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * 检查异常返回的错误吗
     */
    public static Integer CHECKED_EXCEPTION_CODE = 2;

    public CheckedException(String message) {
        super(message);
    }

    /**
     * 异常，只有错误码
     *
     * @param code
     */
    public CheckedException(Integer code) {
        super(code);
    }

    /**
     * 异常，有错误码和消息
     *
     * @param code
     */
    public CheckedException(Integer code, String message) {
        super(code, message);
    }

    public CheckedException(Throwable cause) {
        super(cause);
    }

    public CheckedException(String message, Throwable cause) {
        super(message, cause);
    }

    public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    /**
     * 异常，错误对象
     *
     * @param codeMessage
     */
    public CheckedException(ICodeMessage codeMessage) {
        super(codeMessage);
    }

    /**
     * 错误码
     *
     * @return
     */
    @Override
    public Integer getCode() {
        return CHECKED_EXCEPTION_CODE;
    }
}
